/* xbipfi.h */


/*
 A standard DVD has only one partition. This partition is described by a PFI (Physical Format Information) sector.
 The standard PFI on the Xbox 360 drives points to the Intro video that plays when you put the DVD in a non-Xbox device.
 The Security Sector (SS) contains a hidden PFI, that the Xbox DVD-drive reads and interprets as the one and only PFI,
 which this times points to the actual game data
 */


#ifndef XBI_PFI
#define XBI_PFI 1

#include <xbi/xbicommon.h>

#define _XBIXbox360StartPSN 0x30000

typedef enum {
    kXBIPFIGeneralVersion,
    kXBIPFIXbox360Version
} XBIPFIVersion;

typedef struct _XBIPhysicalFormatInformation XBIPhysicalFormatInformation;

// Creation - Copy - Deletion
XBIPhysicalFormatInformation * XBIPFICreateFromBuffer(XBIPFIVersion version, byte_t * buffer, int size, XBIError * error);
XBIPhysicalFormatInformation * XBIPFICreateFromFile(XBIPFIVersion version, FILE * file, XBIError * error);
XBIPhysicalFormatInformation * XBIPFICopy(XBIPhysicalFormatInformation * pfi);
void XBIPFIDelete(XBIPhysicalFormatInformation * pfi);

// Data manipulation
int32_t XBIPFIGetLayer0SizeInSectors(XBIPhysicalFormatInformation * pfi);
int32_t XBIPFIGetLayer1SizeInSectors(XBIPhysicalFormatInformation * pfi);    
off_t XBIPFIGetDiscSize(XBIPhysicalFormatInformation * pfi);
uint32_t XBIPFIGetCRC32(XBIPhysicalFormatInformation * pfi);

//Accessors
byte_t * XBIPFIGetData(XBIPhysicalFormatInformation * pfi);
size_t XBIPFIGetSize(XBIPhysicalFormatInformation * pfi);
int32_t XBIPFIGetStartPSN(XBIPhysicalFormatInformation * pfi);

#endif
